package com.example.demo01.controller;

import com.example.demo01.entity.User;
import com.example.demo01.request.GetOneRequest;
import com.example.demo01.request.GetUserListRequest;
import com.example.demo01.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/api/user")
@Api(tags = "用户管理相关接口")
public class UserController {

    @Resource
    private UserService userService;

    @PostMapping("/list")
    @ApiOperation(value = "用户管理-获取用户列表")
    public List<User> getUserList(@RequestBody GetUserListRequest getUserListRequest) {
        return userService.getUserList(getUserListRequest);
    }

    @PostMapping("/one")
    public User getOne(@RequestBody GetOneRequest request){
        return userService.getOneUser(request);
    }

    @PostMapping("/export")
    @ApiOperation(value = "用户管理-获取用户列表")
    public void exportUserList() {
        userService.exportUserList();
    }
}
